//
//  CapCell.m
//  WhereToTravel
//
//  Created by dlios on 15/10/17.
//  Copyright © 2015年 zhoushengmin. All rights reserved.
//

#import "CapCell.h"
#define W [[UIScreen mainScreen]bounds].size.width/375
#define H [[UIScreen mainScreen]bounds].size.height/667
@implementation CapCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatView];
    }
    return self;
}
- (void)creatView {
    [super createView];
    self.topImage = [[UIImageView alloc]init];
    self.littleImage = [[UIImageView alloc]init];
    self.numLabel = [[UILabel alloc]init];
    self.locaLabel = [[UILabel alloc]init];
    self.imageViewOne = [[UIImageView alloc]init];
    self.imageViewTwo = [[UIImageView alloc]init];
    self.imageViewThree = [[UIImageView alloc]init];
    self.imageViewFour = [[UIImageView alloc]init];
    self.imageViewFive = [[UIImageView alloc]init];
    self.contentListLabel = [[UILabel alloc]init];
    self.nameLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.topImage];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.littleImage];
    [self.contentView addSubview:self.contentListLabel];
    [self.contentView addSubview:self.numLabel];
    [self.contentView addSubview:self.locaLabel];
    [self.contentView addSubview:self.imageViewOne];
    [self.contentView addSubview:self.imageViewTwo];
    [self.contentView addSubview:self.imageViewThree];
    [self.contentView addSubview:self.imageViewFour];
    [self.contentView addSubview:self.imageViewFive];
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.imageViewOne.frame = CGRectMake(W*30, H*180, W*20, H*20);
    self.imageViewTwo.frame = CGRectMake(W*50, H*180, W*20, H*20);
    self.imageViewThree.frame = CGRectMake(W*70, H*180, W*20, H*20);
    self.imageViewFour.frame = CGRectMake(W*90, H*180, W*20, H*20);
    self.imageViewFive.frame = CGRectMake(W*110, H*180, W*20, H*20);
    self.topImage.frame = CGRectMake(0, 0, W*375, H*200);
    self.littleImage.frame = CGRectMake(W*30, H*180, W*40, H*40);
    self.userLabel.frame = CGRectMake(W*75, H*200, W*200, H*20);
    self.titleLabel.frame = CGRectMake(W*10, H*220, W*250, H*30);
    self.contentLabel.frame = CGRectMake(W*10, H*250, W*365, H*50);
    
    self.numLabel.frame = CGRectMake(W*325, H*20, W*40, H*20);
    self.locaLabel.frame = CGRectMake(W*325, H*40, W*40, H*20);
    self.nameLabel.frame = CGRectMake(W*30, H*160, W*375, H*20);
    self.littleImage.layer.cornerRadius = 20;
    self.littleImage.layer.masksToBounds = YES;
    self.userLabel.textColor = [UIColor colorWithWhite:0.673 alpha:1.000];
    self.userLabel.font = [UIFont systemFontOfSize:12];
    self.titleLabel.font = [UIFont boldSystemFontOfSize:14];
    self.contentLabel.textColor = [UIColor colorWithWhite:0.673 alpha:1.000];
    self.contentLabel.font = [UIFont systemFontOfSize:12];
    self.contentLabel.numberOfLines = 0;
    self.numLabel.textColor = [UIColor whiteColor];
    self.numLabel.font = [UIFont boldSystemFontOfSize:15];
    self.numLabel.textAlignment = NSTextAlignmentCenter;
    self.locaLabel.textColor = [UIColor whiteColor];
    self.locaLabel.font = [UIFont boldSystemFontOfSize:12];
    self.nameLabel.font = [UIFont boldSystemFontOfSize:15];
    self.nameLabel.textColor = [UIColor whiteColor];
    self.contentListLabel.font = [UIFont systemFontOfSize:12];
    self.contentListLabel.numberOfLines = 0;
    self.contentListLabel.textColor = [UIColor colorWithWhite:0.673 alpha:1.000];
    NSMutableDictionary *fontDic = [NSMutableDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:12],NSFontAttributeName, nil];
    CGRect rect = [self.contentListLabel.text boundingRectWithSize:CGSizeMake(375 * W, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:fontDic context:nil];
    self.contentListLabel.frame = CGRectMake(0, H*220, W*365, rect.size.height);
}
@end
